#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int count;
    char c;
    string str;
    cin >> count >> c;
    getchar();
    getline(cin, str);
    if (count >= str.size())
    {
        for (int i = str.size();i < count;i++)
        {
            str.insert(str.begin(), c);
        }
        cout << str << endl;
    }
    else {
        for (int i = str.size() - count;i < str.size();i++)
        {
            cout << str[i];
        }
        cout << endl;
    }
    return 0;
}
